<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

<ui:define name="head">
    <script type="text/javascript">
        document.onkeydown = function TabReplace() {
            if (event.keyCode == 13) {
                if (event.srcElement.tagName != 'BUTTON')
                    event.keyCode = 9;
            }
        }
    </script>

</ui:define>
<ui:define name="content">
    <div style="margin:5px">
        <p:tabView id="tabview" dynamic="true" cache="false" style="font-weight:normal;font-style:normal">
            <p:tab title="海尔卡消费信息汇总">

                <p:dataTable id="pdtproj" dynamic="true" style="width:100%;"
                             value="#{cardTypeConsumeInfoAction.projCardInfoList}" var="record"
                             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                             paginator="true" rows="5" paginatorPosition="bottom"
                             rowsPerPageTemplate="100,50,30,15,5"
                             emptyMessage="没有查询到数据记录...">
                    <p:column headerText="项目ID" style="text-align: center">
                        <h:outputText value="#{record.projid}"/>
                    </p:column>
                    <p:column headerText="项目名称" style="text-align: left;">
                        <h:outputText value="#{record.projName}"/>
                    </p:column>
                    <p:column headerText="商户名称" style="text-align: left">
                        <h:outputText value="#{record.storeName}"/>
                    </p:column>
                    <p:column headerText="卡专户账号" style="text-align: left">
                        <h:outputText value="#{record.storeCardActno}"/>
                    </p:column>
                    <p:column headerText="专户余额">
                        <h:outputText value="#{record.storeBalAmt}" style="float: right">
                            <f:convertNumber pattern="###,##0.00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="工贸名称" style="text-align: left">
                        <h:outputText value="#{record.gmName}"/>
                    </p:column>
                    <p:column headerText="工贸结算账号" style="text-align: left">
                        <h:outputText value="#{record.gmActno}"/>
                    </p:column>
                    <p:column headerText="结算户余额">
                        <h:outputText value="#{record.gmBalAmt}" style="float: right">
                            <f:convertNumber pattern="###,##0.00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="开卡总数" style="text-align: right;">
                        <h:outputText value="#{record.openCardCnt}"/>
                    </p:column>
                    <p:column headerText="启用卡数" style="text-align: right;">
                        <h:outputText value="#{record.usingCardCnt}"/>
                    </p:column>
                    <p:column headerText="挂失卡数" style="text-align: right;">
                        <h:outputText value="#{record.lossCardCnt}"/>
                    </p:column>
                    <p:column headerText="冻结卡数" style="text-align: right;">
                        <h:outputText value="#{record.frozenCardCnt}"/>
                    </p:column>
                    <p:column headerText="注销卡数" style="text-align: right;">
                        <h:outputText value="#{record.cancelCardCnt}"/>
                    </p:column>
                    <p:column headerText="开卡总金额">
                        <h:outputText value="#{record.allCardTotalAmt}" style="float: right">
                            <f:convertNumber pattern="###,##0.00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="启用总金额">
                        <h:outputText value="#{record.openCardTotalAmt}" style="float: right">
                            <f:convertNumber pattern="###,##0.00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="消费总额">
                        <h:outputText value="#{record.cardConsumeTotalAmt}" style="float: right">
                            <f:convertNumber pattern="###,##0.00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="可消费余额">
                        <h:outputText value="#{record.cardTotalBalAmt}" style="float: right">
                            <f:convertNumber pattern="###,##0.00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="已清算额">
                        <h:outputText value="#{record.squaredAmt}" style="float: right">
                            <f:convertNumber pattern="###,##0.00"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="未清算余额">
                        <h:outputText value="#{record.noSquareAmt}" style="float: right">
                            <f:convertNumber pattern="###,##0.00"/>
                        </h:outputText>
                    </p:column>
                </p:dataTable>

                <h:form>
                    <div id="qrytable">
                        <p:growl id="msgs" showDetail="false"/>

                        <p:separator/>
                        <h:outputLabel value="项目公司:"/>
                        <h:selectOneMenu value="#{cardTypeConsumeInfoAction.projid}" style="width: 187px;">
                            <f:selectItems value="#{cardTypeConsumeInfoAction.projOptions}"/>
                        </h:selectOneMenu>
                        <p:commandButton value="查询" action="#{cardTypeConsumeInfoAction.onQry}"
                                         style="margin-left:30px;width:100px;" update="balPanel,pdt"/>
                        <p:commandButton style="width:100px;margin-left:450px;" value="导出EXCEL"
                                         action="#{cardTypeConsumeInfoAction.onExportExcel}"
                                         ajax="false"/>
                        <p:panel id="balPanel" style="margin-top:10px">
                            <h:panelGrid columns="10">
                                <h:outputLabel value="开卡总数:"/>
                                <h:outputLabel value="#{cardTypeConsumeInfoAction.openCardCnt}"/>
                                <h:outputLabel value="启用卡数:"/>
                                <h:outputLabel value="#{cardTypeConsumeInfoAction.usingCardCnt}"/>

                                <h:outputLabel value="挂失卡数:"/>
                                <h:outputLabel value="#{cardTypeConsumeInfoAction.lossCardCnt}"/>
                                <h:outputLabel value="冻结卡数:"/>
                                <h:outputLabel value="#{cardTypeConsumeInfoAction.frozenCardCnt}"/>
                                <h:outputLabel value="注销卡数:"/>
                                <h:outputLabel value="#{cardTypeConsumeInfoAction.cancelCardCnt}"/>
                                <h:outputLabel value="开卡总金额:"/>
                                <h:outputLabel value="#{cardTypeConsumeInfoAction.allCardTotalAmt}"
                                               style="float: right">
                                    <f:convertNumber pattern="###,##0.00"/>
                                </h:outputLabel>
                                <h:outputLabel value="启用总金额:"/>
                                <h:outputLabel value="#{cardTypeConsumeInfoAction.openCardTotalAmt}"
                                               style="float: right">
                                    <f:convertNumber pattern="###,##0.00"/>
                                </h:outputLabel>
                                <h:outputLabel value="卡消费总额:"/>
                                <h:outputLabel value="#{cardTypeConsumeInfoAction.cardConsumeTotalAmt}"
                                               style="float: right">
                                    <f:convertNumber pattern="###,##0.00"/>
                                </h:outputLabel>

                                <h:outputLabel value="可消费余额:"/>
                                <h:outputLabel value="#{cardTypeConsumeInfoAction.cardTotalBalAmt}"
                                               style="float: right">
                                    <f:convertNumber pattern="###,##0.00"/>
                                </h:outputLabel>

                                <h:outputLabel value="已清算金额:"/>
                                <h:outputLabel value="#{cardTypeConsumeInfoAction.squaredAmt}" style="float: right">
                                    <f:convertNumber pattern="###,##0.00"/>
                                </h:outputLabel>

                                <h:outputLabel value="未清算余额:"/>
                                <h:outputLabel value="#{cardTypeConsumeInfoAction.noSquareAmt}"
                                               style="float: right">
                                    <f:convertNumber pattern="###,##0.00"/>
                                </h:outputLabel>
                            </h:panelGrid>
                        </p:panel>
                        <br/>
                        <p:dataTable id="pdt" dynamic="true" style="width:100%;"
                                     value="#{cardTypeConsumeInfoAction.cardActList}" var="record"
                                     paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                     paginator="true" rows="5" paginatorPosition="bottom"
                                     rowsPerPageTemplate="100,50,30,15,5"
                                     emptyMessage="没有查询到数据记录...">
                            <p:column headerText="卡号" style="text-align: center">
                                <h:outputText value="#{record.cardno}"/>
                            </p:column>
                            <p:column headerText="面额">
                                <h:outputText value="#{record.openamt}" style="float: right">
                                    <f:convertNumber pattern="###,##0.00"/>
                                </h:outputText>
                            </p:column>
                            <p:column headerText="已消费额">
                                <h:outputText value="#{record.consumeAmt}" style="float: right">
                                    <f:convertNumber pattern="###,###,##0.00"/>
                                </h:outputText>
                            </p:column>

                            <p:column headerText="余额">
                                <h:outputText value="#{record.actBal}" style="float: right">
                                    <f:convertNumber pattern="###,###,##0.00"/>
                                </h:outputText>
                            </p:column>

                            <p:column headerText="上次记账日" style="text-align: center">
                                <h:outputText value="#{record.lstDate}"/>
                            </p:column>

                            <p:column headerText="卡状态" style="text-align: center">
                                <h:outputText
                                        value="#{cdtCardAction.cardStatus.valueOfAlias(record.cardsts).title}"/>
                            </p:column>
                            <p:column headerText="发卡日期" style="text-align: center">
                                <h:outputText value="#{record.opendate}"/>
                            </p:column>
                            <p:column headerText="有效日期" style="text-align: center">
                                <h:outputText value="#{record.valdate}"/>
                            </p:column>
                        </p:dataTable>
                    </div>
                </h:form>
            </p:tab>
        </p:tabView>
    </div>
</ui:define>
</ui:composition>